<template>
	<view>
		<u-navbar placeholder fixed autoBack border title="信用管理"></u-navbar>
		<view class="d-p-30" v-if="info">
			<view><text class="d-font-36" style="font-weight: bold;">人员信用信息</text></view>
			<view class="card d-m-t-30 d-p-30">
				<view class="d-flex" style="font-weight: bold;color: #162233;">
					<view class="d-m-t-10"><u--image :src="info.profile || '/static/image/photo.png'" width="180rpx" height="210rpx" radius="6"></u--image></view>
					<view class="d-flex-1 d-p-l-30">
						<view class="d-flex">
							<text class="d-font-36 u-line-1" style="max-width: 290rpx;">{{ info.xm }}</text>
							<text class="d-font-24 d-m-l-40 d-m-r-20" style="color: #ADB4BD;">{{ info.xb || '保密' }}</text>
							<u-line direction="col" length="36rpx"></u-line>
							<text class="d-font-24 d-m-l-20" style="color: #ADB4BD;">{{ info.mz || '无数据源' }}</text>
						</view>
						<view class="d-flex d-font-24 d-m-t-20">
							<text style="color: #ADB4BD;">电话</text>
							<u--text class="d-m-l-20" :customStyle="{ fontWeight: 'bold' }" color="#21A5F3" size="24rpx" mode="phone" call :text="info.lxfs"></u--text>
						</view>
						<view class="d-flex d-font-24 d-m-t-20">
							<view class="d-flex-1 d-flex">
								<text style="color: #ADB4BD;">班组</text>
								<text class="d-m-l-20 u-line-1" style="max-width: 160rpx;">{{ info.bzmc || '无数据源' }}</text>
							</view>
							<text style="color: #ADB4BD;">工种</text>
							<text class="d-m-l-20 u-line-1" style="min-width: 80rpx;max-width: 100rpx;">{{ info.drzw || '无数据源' }}</text>
						</view>
						<view class="d-flex d-font-24 d-m-t-20">
							<text style="color: #ADB4BD;">证件号码</text>
							<text class="d-m-l-20">{{ info.zjhm | str }}</text>
						</view>
					</view>
				</view>
				<view class="d-flex d-font-24 d-m-t-20" style="color: #162233;font-weight: bold;">
					<text>单位名称</text>
					<text class="d-m-l-20 d-flex-1 u-line-1">{{ info.qymc }}</text>
				</view>
				<view class="d-flex d-font-24 d-m-t-10" style="color: #162233;font-weight: bold;">
					<text>所属项目名称</text>
					<text class="d-m-l-20 d-flex-1 u-line-1">{{ info.gcmc }}</text>
				</view>
			</view>

			<view class="d-m-t-50"><text class="d-font-36" style="font-weight: bold;">信用列表</text></view>

			<view class="card d-m-t-30 d-p-30" style="height: 380rpx;" v-if="!percer || percer.length <= 0">
				<view class="d-m-t-20"><u-empty text="暂无数据源" icon="/static/image/none.png"></u-empty></view>
			</view>
			<template v-else>
				<view class="card d-m-t-30 d-p-30" v-for="(item, index) in percer" :key="index">
					<view class="d-flex" style="color: #5D6672;">
						<view class="d-flex-1 d-font-28 d-flex">
							<text style="font-weight: bold;">项目</text>
							<text class="d-m-l-20 d-flex-1 u-line-1">{{ item.gcmc }}</text>
						</view>
					</view>
					<view class="d-flex d-m-t-20" style="color: #5D6672;">
						<view class="d-flex-1 d-font-28 d-flex">
							<text style="font-weight: bold;">企业</text>
							<text class="d-m-l-20 u-line-1 d-flex-1">{{ item.deptName }}</text>
						</view>
						<view class="d-font-28" style="width: 260rpx;">
							<text style="font-weight: bold;">时间</text>
							<text class="d-m-l-20">{{ item.createTime ? $moment(item.createTime).format('MM月DD日') : '无数据源' }}</text>
						</view>
					</view>
					<view class="d-flex d-m-t-20" style="color: #5D6672;">
						<view class="d-flex-1 d-font-28 d-flex">
							<text style="font-weight: bold;">姓名</text>
							<text class="d-m-l-20 d-flex-1 u-line-1">{{ item.xm }}</text>
						</view>
						<view class="d-font-28" style="width: 260rpx;">
							<text style="font-weight: bold;">类型</text>
							<text class="d-m-l-20">{{ item.type }}</text>
						</view>
					</view>
					<view class="d-flex d-m-t-20" style="color: #5D6672;">
						<view class="d-flex-1 d-font-28 d-flex">
							<text style="font-weight: bold;">班组</text>
							<text class="d-m-l-20 d-flex-1 u-line-1">{{ item.bzmc }}</text>
						</view>
						<view class="d-font-28" style="width: 260rpx;">
							<text style="font-weight: bold;">工种</text>
							<text class="d-m-l-20">{{ item.worktype }}</text>
						</view>
					</view>
				</view>
			</template>
		</view>
	</view>
</template>

<script>
import { getStaff, getPercerList } from '../../../common/api.js';
export default {
	data() {
		return {
			info: null,
			percer: null
		};
	},
	onLoad() {
		this.init();
	},
	methods: {
		init() {
			uni.showLoading({
				title: '加载中...',
				mask: true
			});
			getStaff({
				id: this.$user.ssgcxx[this.$appIndex].rybh, // 人员id
			}).then(e => {
				this.info = e.data;
				uni.hideLoading();
				
				// 这个接口 改过了 之前测试是OK的
				// getPercerList({
				// 	params: {
				// 		bzid: this.$user.ssgcxx[this.$appIndex].bzid, // 班组id
				// 		rybh: this.$user.ssgcxx[this.$appIndex].rybh, // 人员id
				// 	}
				// }).then(e => {
				// 	this.percer = e.data;
				// });
			});
		}
	}
};
</script>

<style lang="scss">
page {
	background-color: #fbfcfc;
}
.card {
	box-shadow: 0rpx 5rpx 10rpx rgba(0, 0, 0, 0.05);
	border-radius: 10rpx;
	background-color: #ffffff;
}
</style>
